Skip to content

Conversation

@TigerInYourDream
Copy link

Summary

Add MpLink component - a clickable link widget similar to HTML <a> tag.

Features

  • ✅ Click handling with href property to open URLs
  • ✅ Hover and pressed states with smooth animations
  • ✅ Underline decoration using custom shader
  • ✅ Keyboard support (Enter/Space keys)
  • ✅ Disabled state support
  • ✅ Action system integration (MpLinkAction::Clicked)
  • ✅ Hand cursor on hover

Implementation Details

Core Component (crates/ui/src/widgets/link.rs)

  • Uses DrawText for text rendering
  • Uses DrawQuad with custom shader for underline decoration
  • Implements hover/pressed animations with opacity transitions
  • Opens URLs using cx.open_url(href, OpenUrlInPlace::No)
  • Supports keyboard activation (Enter/Space)

Demo (crates/component-zoo/src/app.rs)

  • Basic links section with multiple examples
  • Inline usage showing links within text flow

Documentation

  • Updated CLAUDE.md to mark Link as implemented
  • Moved from "待实现组件" to "已实现组件"

Commits

  1. c4b7cf3 - Initial Link component implementation
  2. e77294e - Improvements based on makepad-skills guidance:
    • Add underline decoration shader
    • Declare shader instance variables
    • Add keyboard support
    • Extract activate_link() helper method

Testing

  • ✅ Compiles successfully with cargo check
  • ✅ Follows Makepad widget patterns
  • ✅ Uses makepad-skills best practices

Screenshots

See Component Zoo demo for visual examples.

- Implement MpLink widget with href and click handling
- Add hover/pressed states with animations
- Add Link demo section to component-zoo
- Update CLAUDE.md to mark Link as implemented
- Add underline decoration using draw_underline shader
- Declare instance variables (hover, pressed) in shaders
- Add keyboard support (Enter/Space keys)
- Extract activate_link helper method
- Follow makepad event handling patterns
Resolve conflicts by:
- Keep upstream CLAUDE.md (skills routing guide)
- Merge mod.rs: add link module alongside new components
- Merge app.rs: add link import alongside alert import
- Accept upstream changes for other components
@TigerInYourDream TigerInYourDream marked this pull request as draft January 22, 2026 05:29
@TigerInYourDream TigerInYourDream marked this pull request as ready for review January 23, 2026 12:27
@TigerInYourDream TigerInYourDream closed this by deleting the head repository Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant